﻿{% load static %}
<html lang="en">
<div>
    <style>* {
        box-sizing: border-box;
    }

    body {
        margin: 0;
    }

    * {
        box-sizing: border-box;
    }

    body {
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
        margin-left: 0px;
        font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Roboto, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft Yahei", "Microsoft Jhenghei", sans-serif;
    }

    .logo path {
        pointer-events: none;
        fill: none;
        stroke-linecap: round;
        stroke-width: 7;
        stroke: rgb(255, 255, 255);
    }

    .wechat-group img {
        max-width: 220px;
        height: auto;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        border-bottom-right-radius: 8px;
        border-bottom-left-radius: 8px;
        margin-top: 0px;
        margin-right: auto;
        margin-bottom: 0px;
        margin-left: auto;
        width: 100%;
    }

    .welcome-img img {
        width: 100%;
    }

    .c1821 {
        display: none;
    }

    .c1812 {
        background: url('https://template-1253409072.cos.ap-guangzhou.myqcloud.com/html-template/assets/img/bg/4.jpg') no-repeat right center;
    }

    header {
        background-color: rgb(255, 255, 255);
    }

    header .navbar-nav a.nav-link {
        color: rgb(119, 119, 119);
    }

    header .navbar-nav a.nav-link:hover {
        color: rgb(82, 139, 255);
    }

    header .navbar-nav .active a.nav-link {
        color: rgb(68, 68, 68);
    }

    header .navbar-toggler-icon {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 30 30' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(0, 0, 0, 0.5)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
    }

    header.bg-dark .navbar-nav a.nav-link {
        color: rgb(220, 220, 220);
    }

    header.bg-dark .navbar-nav a.nav-link:hover {
        color: rgb(82, 139, 255);
    }

    header.bg-dark .navbar-nav .active a.nav-link {
        color: rgb(255, 255, 255);
    }

    header.bg-dark .navbar-toggler-icon {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='#fff' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E");
    }

    header + header {
        border-top-width: 1px;
        border-top-style: solid;
        border-top-color: rgb(238, 238, 238);
    }

    .collapse.navbar-collapse {
        border-color: #1077e3;
        background-color: #1cc5f4;
    }

    .nav-link {
        font-size: 19px;
    }

    .htmlpage-row {
        display: table;
        padding-top: 10px;
        padding-right: 10px;
        padding-bottom: 10px;
        padding-left: 10px;
        width: 100%;
    }

    .htmlpage-cell {
        width: 8%;
        display: table-cell;
        height: 75px;
    }

    .btn.btn-empty.ml-md-3 {
        font-size: 17px;
        color: #d12020;
    }

    @media (max-width: 768px) {
        .htmlpage-cell {
            width: 100%;
            display: block;
        }
    }</style>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="keywords" content=""/>
    <link rel="stylesheet" href={% static "css/bootstrap.min.css" %}/>
    <link rel="stylesheet" href={% static  "css/page.min.css" %}/>
    <header data-block-type="headers" data-id="1" class="fp-active">
        <div class="container">
            <nav class="navbar navbar-expand-md">
                <button type="button" data-toggle="collapse" data-target="#navbarNav1" aria-controls="navbarNav1"
                        aria-expanded="false" aria-label="Toggle navigation" class="navbar-toggler"><span
                        class="navbar-toggler-icon"></span></button>
                <div id="navbarNav1" class="collapse navbar-collapse">
                    <ul class="navbar-nav mr-auto">
                        <li class="nav-item">
                            <a href="/admin/" class="nav-link">发帖管理</a></li>
                        <li class="nav-item active">
                            <a href="/admin/user_control/" class="nav-link">用户管理
                                <span class="sr-only">(current)</span></a></li>
                    </ul>
                    <a href="/admin/user_add/" class="nav-link" >添加用户</a>
                    <a href="/admin/logout/" class="btn btn-empty ml-md-3">注销</a>
                </div>
            </nav>
        </div>
    </header>
    <div class="htmlpage-row">
        <div class="htmlpage-cell">
            <div class="htmlpage-row">
                <div class="htmlpage-cell"></div>
            </div>
        </div>
    </div>
    <div>
        <div class="container">
            <div class="row">
                <div class="col-md-6"><h2>用户列表</h2>
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>用户名</th>
                            <th>邮件</th>
                            <th>年龄</th>
                            <th>性别</th>
                            <th>是否管理员</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tdiv>
                            {% for user in users %}
                                <tr>
                                    <td>{{ user.username }}</td>
                                    <td>{{ user.email }}</td>
                                    <td>{{ user.age }}</td>
                                    {% if user.sex == 2 %}
                                        <td>女</td>
                                    {% elif user.sex == 1 %}
                                        <td>男</td>
                                    {% else %}
                                        <td>保密</td>
                                    {% endif %}
                                    {% if user.is_admin == 1 %}
                                        <td>是</td>
                                    {% else %}
                                        <td>否</td>
                                    {% endif %}
                                    <td>
                                        <a href="/admin/user_control?cmd=del&id={{ user.id }}"
                                           class="btn btn-danger">删除</a>
                                        {% if user.is_admin == 0 %}
                                            <button type="button" class="btn btn-primary" style="background: #7291EE">
                                                <a style="text-decoration: none;color: #0f0f0f"
                                                   href="/admin/user_control?cmd=addadmin&id={{ user.id }}">设为管理员</a>
                                            </button>

                                        {% else %}
                                            <button type="button" class="btn btn-primary" style="background: #7291EE">
                                                <a style="text-decoration: none;color: #0f0f0f"
                                                   href="/admin/user_control?cmd=removeadmin&id={{ user.id }}">取消管理员</a>
                                            </button>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        </tdiv>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
</html>